<template>
  <div :class="{'theme-market': showMarketingBar}"
    v-if="ebooksDetail != ''"
  >
    <!-- 课程详情top -->
    <div class="c-bg-white c-bd-b10-f5">
      <div class="c-bg-white c-hh410 c-text-hidden c-flex-row c-aligni-center c-justify-center c-p cover-container">
        <div class="c-flex-row c-aligni-center c-justify-center cover-inner c-br10 c-p c-text-hidden">
          <img
            class="c-block c-maxW c-maxh imgCloseBig c-m-0auto c-p c-pz10 cover-img imgCloseBig" :class="[cfg.isCopyPicture == 0 ? 'closeBig' : 'aCloseBig', cfg.isCopy == 0 ? 'copyNot' : '']"
            :src="$addXossFilter(ebooksDetail.avatar)"
            alt=""
          >
          <img :src="$addXossFilter(ebooksDetail.avatar)" class="cover-filter-img" :class="[cfg.isCopyPicture == 0 ? 'closeBig' : 'aCloseBig', cfg.isCopy == 0 ? 'copyNot' : '']"/>
          <div class="bg-shadow"></div>
          <div @click="clickPreviewImage(ebooksDetail.avatar)" class="c-pa c-p-r0 c-p-t0 c-p-l0 c-flex-row c-justify-end"><div class="c-translucent-balck60 zoom-btn"><span class="iconfont c-fc-white c-fs24">&#xe86d;</span></div></div>
        </div>
        <div class="c-hh30 c-fs16 c-fc-white c-lh30 c-translucent-balck60 c-ph6 c-pa c-p-b28 c-p-r28 c-br4">电子书</div>
        <div
          v-if="ebooksDetail.assetStatus == -1"
          class="c-bg-e6 c-hh48 c-flex-row c-flex-center c-fs24 c-fc-gray c-pa c-p-t0 c-p-l0 c-p-r0"
        >该电子书已被管理员删除，如有疑问请咨询客服</div>
      </div>
      <price-bar
        class="c-ph12 ebooksPriceBar c-mt10"
        v-if="!(ebooksDetail.hasPermission || ebooksDetail.isFriendHelper || ebooksDetail.sales || ebooksDetail.bargain || ebooksDetail.collage || ebooksDetail.isSaleOnly == 0)"
        :dataInfo="ebooksDetail"
      >
      </price-bar>
      <!-- <div v-if="ebooksDetail.hasPermission && !(ebooksDetail.sales != null || ebooksDetail.collage != null || ebooksDetail.isFriendHelper == true) && ebooksDetail.isSaleOnly != 0 && ebooksDetail.payType == 2" class="c-fc-xmlred c-fs34 c-fw600 c-flex-row c-aligni-center c-ph12 c-mt20">
        <span class="c-fs20 c-lh">{{'￥' | iosPriceFilter}}</span>
        <span>{{Number(ebooksDetail.price).toFixed(2) | moneyStr}}</span>
      </div> -->
      <flash-sales-time-new
        v-if="showMarketingBar"
        :type="ebooksDetail.isFriendHelper ? 'isFa' : ebooksDetail.sales ? 'isSale' : ebooksDetail.bargain ? 'isBargain' : ebooksDetail.collage ? 'isCollage' : ''"
        :originalPrice="ebooksDetail.price"
        :price="ebooksDetail.bargain ? ebooksDetail.bargain.reservePrice : ebooksDetail.sales ? ebooksDetail.sales.price : ebooksDetail.collage ? ebooksDetail.collage.captainPrice : ''"
        :startTime="ebooksDetail.bargain ? ebooksDetail.bargain.startTime : ebooksDetail.sales ? ebooksDetail.sales.sales.startTime : ebooksDetail.collage ? ebooksDetail.collage.startTime : ebooksDetail.faStartAt"
        :endTime="ebooksDetail.bargain ? ebooksDetail.bargain.endTime : ebooksDetail.sales ? ebooksDetail.sales.sales.endTime : ebooksDetail.collage ? ebooksDetail.collage.endTime : ebooksDetail.faEndAt"
        :isLimit="ebooksDetail.sales && ebooksDetail.sales.limit == 0 || (ebooksDetail.bargain && ebooksDetail.bargain.isLimitStock == 2) ? false : true"
        :stockBargain="ebooksDetail.bargain && ebooksDetail.bargain.stock"
        :bargainStatus="ebooksDetail.bargain && ebooksDetail.bargain.status"
        :isPreheat="ebooksDetail.bargain && ebooksDetail.bargain.isPreheat"
        :salesTag="ebooksDetail.sales && ebooksDetail.sales.sales.tahs"
        :stock="ebooksDetail.sales ? ebooksDetail.sales.balance: ''"
        :peopleNum="ebooksDetail.collage && ebooksDetail.collage.peopleNum"
        :from="ebooksDetail.collage && ebooksDetail.collage.collageGroupType && ebooksDetail.collage.collageGroupType == 2 ? 'activity' : ''"
        :optimal="optimal"
        @falshSalesTime="falshSalesTime"
        @finishFlashSales="finishFlashSales"
      >
      </flash-sales-time-new>
      <div class="c-ph12 c-pv20">
        <div class="c-fs28 c-fw500 c-fc-xblack">{{ebooksDetail.name}}</div>
        <div class="theme-fc c-flex-row c-aligni-center c-fs24 c-mt10" v-if="ebooksDetail.hasPermission && !(ebooksDetail.sales != null || ebooksDetail.collage != null || ebooksDetail.isFriendHelper == true) && ebooksDetail.isSaleOnly != 0">
          <span v-if="ebooksDetail.payType == 1 || ebooksDetail.payType == 3">{{ebooksDetail.payType == 1 ? '免费' :ebooksDetail.payType == 3 ? '加密' : ''}}</span>
        </div>
        <div class="c-fs20 c-fc-sblack c-text-ellipsis1 c-mt10">{{ebooksDetail.author}}</div>
        <div class="c-fs20 c-fc-sblack c-text-ellipsis1 c-flex-row c-justify-sb c-mt10">
          <div class="c-flex-row c-fc-gray">
            <div v-if="!distributionId && (enableShowModuleView == 1 || !(enableHiddenModules && enableHiddenModules.includes(ckFrom.ebooks)))" class="c-flex-row c-aligni-center">
              <span class="c-fs20 iconfont c-mr4">&#xe69c;</span>
              <span class="c-mr20">{{ebooksDetail.viewNum | formatNumber}}次阅读</span>
            </div>
            <div v-if="ebooksDetail.isSaleOnly == 1" class="c-flex-row c-aligni-center">
              <span class="c-fs20 iconfont c-mr4">&#xe7a6;</span>
              <valid-time-com :dataInfo="ebooksDetail" :prodId="id" :prodType="ckFrom.ebooks"></valid-time-com>
            </div>
          </div>
        </div>
      </div>
      <discount-tip
        :dataInfo="ebooksDetail"
        :sales="ebooksDetail.sales"
        :collage="ebooksDetail.collage"
        :isFriendHelper="ebooksDetail.isFriendHelper"
        :couponList="couponList"
        @clickShowCoupon="showCoupon = true"
        :isiOS='isiOS'
        :hasPermission='ebooksDetail.hasPermission'
        :showDiscount="showDiscount"
        :isMarketing='isMarketing'
        :hasGiftRelates="ebooksDetail.giftRelates && ebooksDetail.giftRelates.length > 0 ? true : false"
        :giftRelatesCount="ebooksDetail.giftRelates ? ebooksDetail.giftRelates.length : 0"
        @popGiftModal="popGiftModal"
      ></discount-tip>
      <bargain-rules
        v-if="ebooksDetail.bargain != null && !ebooksDetail.hasPermission"
        :isPreheat="ebooksDetail.bargain.isPreheat"
        :status="ebooksDetail.bargain.status"
        class="c-bd-t12-f5"
      ></bargain-rules>
      <!-- 非强制表单信息 -->
      <formEntry v-if="isForceFrom"
        relType="21"  :relId="id"  :dataInfo="ebooksDetail"
        classObject="c-fs22" fontSizeClass="c-fs20" iconSizeClass="c-fs14" topClass="c-bd-t12-f5"
        @goForm="goForm" ></formEntry>
      <!-- 拼团 -->
      <collage-persons-list
        v-if="ebooksDetail && !ebooksDetail.hasPermission && ebooksDetail.collage != null && (ebooksDetail.collage.status == 2 || ebooksDetail.collage.status == 1)"
        :collage="ebooksDetail.collage"
        @goCollageDetail="gcd"
      ></collage-persons-list>
    </div>

    <section
      id="divider"
      class="minh76"
    >
      <!-- 目录 -->
      <div class="c-bg-white c-ph24 c-bd-b1-f6">
        <my-small-tabbar
          id="tabhBar"
          :styleType="2"
          :tabList="tabList"
          :tabIndex="typeBar"
          @changeTab="changeType"
          class="c-bd-b1-f6"
          :class="tabhBarFixed ? ($isWxApp() || !showNavBar ? 'tabhBar c-wx-top0' : 'tabhBar') : ''"
        ></my-small-tabbar>
      </div>
      <!-- 详情 -->
      <div
        class="c-pt30 c-pb30 c-bg-white"
        v-show="typeBar == 0"
      >
        <course-description
          class="c-ph24"
          ref="descriptions"
          :independentCopy="cfg.isCopy"
          :independentCopyPicture="cfg.isCopyPicture"
          :prodType="ckFrom.ebooks"
          :prodId="id"
        ></course-description>
        <!-- 配套课程 -->
        <div v-if="ebooksDetail.relatedTraining.length > 0">
          <camp-course :relatedTraining="ebooksDetail.relatedTraining" :title="'购买所属课程后可阅读电子书'"></camp-course>
        </div>
        <commentCom ref="detailCommentCom" v-if="isShowComments('detail')" positionType="detail" class="c-bd-t10-f5" :isShowEmpty="false" :prodType="ckFrom.ebooks" :prodId="id" :bindPhoneSetting="bindPhoneSetting" @getCommentCount="getCommentCount" @addCommentSuccess="addCommentSuccess"></commentCom>
      </div>
      <!-- 目录 -->
      <div
        class="c-ph24 c-bg-white c-p"
        v-show="typeBar == 1"
      >
        <template v-if="formatType == 2">
          <div
            class="chapters-title c-flex-row c-justify-sb c-aligni-center c-fs26 c-fc-sgray c-bd-b1"
            v-show="epubArray.length > 0"
          >共{{epubNum}}章</div>
          <div
            class="c-flex-row c-justify-sb c-aligni-start c-bd-b1 c-pv26"
            v-for="(item, index) in epubArray"
            :key="index"
            @click="handleClickReadBookEbup(item)"
          >
            <span
              class="theme-bg c-br20 c-fc-white c-fs16 c-ph12 c-pv5"
              v-show="ebooksDetail.hasPermission == false && watchPermission == 1 && item.isLock == 0"
            >试读</span>
            <div
              class="c-flex-grow1 c-w0 c-fs24 c-ph10"
              :class="{'c-fc-gray': item.isLock == 1, ' c-fc-xblack': item.isLock == 0}"
            >{{item.title}}</div>
            <template v-if="item.isLock == 1">
              <!-- isLock 0:无锁，1：未解锁 -->
              <div class="c-pr14 c-fs16 c-flex-row c-flex-center c-fc-sgray">
                <i class="iconfont">&#xe7a5;</i>
              </div>
            </template>
          </div>
          <loading-status-tem
            :dataStatus="dataStatus"
            :noDataText="'暂无内容'"
          ></loading-status-tem>
        </template>
        <template v-else-if="formatType == 1">
          <div
            v-if="pdfArray.length"
            class="chapters-title c-flex-row c-justify-sb c-aligni-center c-fs26 c-fc-sgray"
          >共{{pdfNum}}页</div>
          <div class="c-flex-row c-flexw-wrap">
            <div
              class="c-p c-ww160 c-hh270 c-mb30 c-bg-white c-bd1-eee"
              :class="[index % 3 == 0 ? '' : 'c-ml56', cfg.isCopyPicture == 0 ? 'closeBig' : 'aCloseBig']"
              v-for="(item, index) in pdfArray"
              :key="index"
              @click="handleClickReadBookPdf(item)"
            >
              <img
                class="c-w100 c-hh234"
                :src="$addXossFilter(item.thumbnailUrl)"
                alt=""
              >
              <p class="c-flex-row c-justify-center c-aligni-center c-w100 c-hh38 c-fs22 c-fc-xblack">{{item.page}}</p>
              <template v-if="item.isLock == 1">
                <!-- isLock 0:无锁，1：未解锁 -->
                <div class="c-pa c-p-t0 c-p-l0 c-w100 c-h c-pz1 c-translucent-balck50"></div>
                <i class="iconlock iconfont">&#xe7a5;</i>
              </template>
            </div>
          </div>
          <!-- loading -->
          <loading-status-tem
            :dataStatus="dataStatus"
            noDataText="暂无内容"
          ></loading-status-tem>
          <div v-if="isOffSale || timingPutOn || isUserGroup" class="c-w100 c-h c-pa c-p-t0 c-p-l0 glass c-translucent-balck3">
            <div class="c-w100 c-h backdropFilter"></div>
            <div class="theme-fc c-textAlign-c c-pa c-w100 c-p-t160">
              <div class="iconfont c-fs46 c-textAlign-c">&#xe8bc;</div>
              <div class="c-fs24 c-pt12 c-textAlign-c">电子书{{timingPutOn ? '暂未上架' : isOffSale ? '已下架' : (ebooksDetail.payType == 2 ? '仅指定用户可购买' : '仅指定用户可阅读')}}</div>
            </div>
          </div>
        </template>
      </div>
      <!-- 相关推荐 -->
      <div
        class="c-bg-white"
        v-show="typeBar == 2"
      >
        <package-index-com
          :showAll="true"
          :isNewRelatedStyle="true"
          :proType="12"
          :proId="id"
          :isHomePage="false"
          :packageList="ebooksDetail.combos"
          v-if="ebooksDetail && ebooksDetail.combos && ebooksDetail.combos.length > 0"
        >
        </package-index-com>
        <loading-status-tem
          v-if="relationData==''"
          :showLoading="true"
        ></loading-status-tem>
        <div class="">
          <active-and-column
            v-if="relationData != ''"
            :courseList="relationData.courses"
            :goodsList="relationData.goods"
            :soicalList="relationData.socials"
            :examList="relationData.exams"
            :speechList="relationData.speechs"
            :mutualList="relationData.mutuals"
            :datumList="relationData.datums"
          ></active-and-column>
        </div>
        <loading-status-tem
          :noData="relationData.courses == '' && relationData.goods == '' && ebooksDetail.combos == '' && relationData.socials == '' && relationData.exams == '' && relationData.speechs == '' && relationData.mutuals == '' && relationData.datums == ''"
          :noDataText="'暂无推荐'"
        ></loading-status-tem>
      </div>
      <!-- 评论 -->
      <div v-if="cfg.enableCommentTag == 1" v-show="typeBar == 3" class="c-bg-white" >
        <commentCom ref="commentCom" v-if="commentStatus == 1" :prodType="ckFrom.ebooks" :prodId="id" :bindPhoneSetting="bindPhoneSetting" @getCommentCount="getCommentCount" @addCommentSuccess="addCommentSuccess"></commentCom>
      </div>
    </section>
    <!-- 优惠卷列表 -->
    <coupon-list-com
      @closeModal="closeModal"
      @getCouponList="getCouponList"
      :couponIsPage="couponIsPage"
      :couponLoading="couponLoading"
      :couponList="couponList"
      :showCoupon="showCoupon"
      :prodId="Number(id)"
      :prodType="142"
      :dataInfo="ebooksDetail"
      :isMarketing="isMarketing"
    >
    </coupon-list-com>
    <!-- 底部栏 -->
    <bottom-buy-com
      :isNew="true"
      ref="bottomBuyCom"
      :ckFromTitle="'电子书'"
      :ckFrom="ckFrom.ebooks"
      :isNeedPay="!ebooksDetail.hasPermission && ebooksDetail.payType == 2"
      :showFriendHelper="ebooksDetail.isFriendHelper"
      :isOffSale="isOffSale"
      :hasExpired="hasExpired"
      :timingPutOn="timingPutOn"
      :showNotSale="ebooksDetail.payType == 2 && ebooksDetail.isSaleOut == 0 && !ebooksDetail.hasPermission"
      :delayTime="ebooksDetail.delayTime"
      :showCommentBtn="isShowComments('icon')"
      @spreadInvite="inviteFriends"
      @invitePoster="invitePoster"
      :showPresentFriend="ebooksDetail.showPresentFriend"
      @clickBuyNow="clickBuyNow"
      @putOn="putOn"
      @clickComment="addComment()"
    >
      <div v-if="isShowComments('tag')" @click="addComment()" class="c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-fs28">
        <div class="c-hh60 c-w0 c-flex-grow1 c-lh64 c-textAlign-c c-fs24 c-ph20 c-fc-gray c-bg-f2 c-br30"> 请输入评论内容</div>
      </div>
      <!-- 指定用户购买或者阅读 -->
      <template v-else-if="isUserGroup">
        <div class="c-bg-b3 c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28">仅指定用户可{{ebooksDetail.payType == 2 ? '购买' : '阅读'}}</div>
      </template>
      <!-- 存在立即购买和试读 payType 1:免费2：付费3：密码-->
      <template v-else-if="ebooksDetail.assetStatus == -1">
        <div class="c-bg-b3 c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28">电子书已被删除</div>
      </template>
      <!-- watchPermission 是否支持试读0不支持，1支持 -->
      <!-- isSaleOnly 单独售卖为1 -->
      <template v-else-if="!ebooksDetail.hasPermission">
        <!-- 付费，单独售卖 -->
        <div v-if="ebooksDetail.payType == 2 && ebooksDetail.isSaleOut == 1 && ebooksDetail.isSaleOnly == 1" class="c-flex-row c-hh64 c-flex-center c-w100">
          <!-- 观看权限，单独控制 -->
          <div v-if="ebooksDetail.watchPermission == 1" class="c-flex-column c-aligni-center c-pr24 c-justify-sb c-hh64" @click="handleClickReadBook">
            <div class="yqImg c-textAlign-c c-lh40"><span class="icon iconfont c-fc-sblack c-fs40">&#xe79a;</span></div>
            <span class="c-fc-xblack c-fs16">试读</span>
          </div>

          <!-- 参加营销活动的统一样式 -->
          <div class="c-lh c-w0 c-flex-grow1 c-flex-row btn-wrap c-fs28">
            <!-- 直接购买整合成一个按钮 -->
            <template>
              <div
                v-if="isShowClickBuy"
                class="c-hh64 c-flex-row c-flex-center c-w0 c-flex-grow1"
                @click="clickBuy"
              >
                <span class="c-fs22 c-lh c-mr12">{{getBuyBtnTitle}}</span>
                <span class="c-fs24 c-lh c-fw-b">{{'￥' | iosPriceFilter}}{{calculationPrice}}</span>
              </div>
              <div v-else-if="ebooksDetail.sales && faStatus == 2"
                class="c-hh64 c-flex-column c-flex-center c-w0 c-flex-grow1"
                @click="handleClickBuySales()"
              >
                <span class="c-fs28 c-lh">{{getBuyBtnTitle}}</span>
              </div>

              <div v-if="ebooksDetail.isFriendHelper && (faStatus == 1 || faStatus == 2)"
                class="c-hh64 c-flex-column c-flex-center c-pt4 c-w0 c-flex-grow1"
                :class="faStatus == 2 ? 'theme-bg-gradient' : 'c-bg-d7'"
                @click="goHelpDetail()"
              >
                <span class="c-fs26">灌溉领取</span>
              </div>
              <div v-else-if="ebooksDetail.bargain != null && ((ebooksDetail.bargain.status == 1 && ebooksDetail.bargain.isPreheat == 1) || ebooksDetail.bargain.status == 2) && ebooksDetail.bargain.userType == 1"
                class="c-hh64 c-flex-column c-flex-center c-pt4 c-w0 c-flex-grow1"
                :class="(ebooksDetail.bargain.status == 1 && ebooksDetail.bargain.isPreheat == 1) ? 'c-bg-d7' : 'theme-bg-gradient'"
                @click="handleClickBargainDetail(ebooksDetail.bargain.bargainId)"
              >正在砍价</div>
              <div v-else-if="ebooksDetail.bargain != null && ((ebooksDetail.bargain.status == 1 && ebooksDetail.bargain.isPreheat == 1) || ebooksDetail.bargain.status == 2) && ebooksDetail.bargain.userType == -1"
                :class="(ebooksDetail.bargain.status == 1 && ebooksDetail.bargain.isPreheat == 1) ? 'c-bg-d7' : 'theme-bg-gradient'"
                class="c-hh64 c-flex-column c-flex-center c-pt4 c-w0 c-flex-grow1"
                @click="handleClickBargainDetail(ebooksDetail.bargain.bargainId)">
                <span class="c-fs24">砍价享</span>
                <span class="c-lh c-fs24 c-mt4">{{'￥' | iosPriceFilter}}{{Number(ebooksDetail.bargain.reservePrice).toFixed(2)}}</span>
              </div>
              <div v-else-if="ebooksDetail.collage != null && ebooksDetail.collage.status == 2 && ebooksDetail.collage.userType != -1"
                @click="goCollageDetail(ebooksDetail.collage.groupId, ebooksDetail.collage.collageId)"
                class="c-hh64 c-flex-row c-flex-center c-w0 c-flex-grow1"
              >
                <span class="c-fs28 c-lh">拼团中...</span>
              </div>

              <div v-else-if="ebooksDetail.collage != null && (ebooksDetail.collage.status == 2 || ebooksDetail.collage.status == 1) && ebooksDetail.collage.userType == -1"
                :class="ebooksDetail.collage.status == 1 ? 'c-bg-d7' : 'theme-bg-gradient'"
                class="c-hh64 c-flex-column c-flex-center c-pt4 c-w0 c-flex-grow1"
                @click="goBuy(-1, ebooksDetail.collage.collageId)"
              >
                <span class="c-fs22 c-lh">{{'￥' | iosPriceFilter}}{{Number(ebooksDetail.collage.captainPrice).toFixed(2)}}</span>
                <span class="c-fs20 c-lh">发起拼团</span>
              </div>
            </template>
          </div>
        </div>

        <div
          class="theme-bg c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28"
          v-if="ebooksDetail.payType == 1 && ebooksDetail.hasPermission && ebooksDetail.isSaleOnly == 1"
          @click="handleClickReadBook"
        >立即阅读</div>
        <div
          class="theme-bg c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28"
          v-if="ebooksDetail.payType == 3 && ebooksDetail.isSaleOnly == 1"
          @click="handleClickPassword"
        >输入密码</div>
        <div
          class="c-bg-d7 c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28"
          v-if="ebooksDetail.payType == 2 && ebooksDetail.isSaleOut == 0 && !ebooksDetail.hasPermission"
        >暂不支持售卖</div>
        <div
          v-if="ebooksDetail.isSaleOnly == 0"
          @click="backPackage()"
          class="theme-bg c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28"
        >购买套餐</div>
      </template>
      <template v-else>
        <div
          class="theme-bg c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28"
          v-if="ebooksDetail.hasPermission"
          @click="handleClickReadBook"
        >开始阅读</div>
        <div
          class="c-bg-d7 c-fc-white c-lh c-w0 c-flex-grow1 c-flex-row c-flex-center c-hh64 c-br36 c-fs28"
          v-if="ebooksDetail.payType == 2 && ebooksDetail.isSaleOut == 0 && !ebooksDetail.hasPermission"
        >暂不支持售卖</div>
      </template>
    </bottom-buy-com>

    <!-- 显示购买赠送积分 -->
    <point-gift :showPoints.sync="showPoints" :prodId="id" :rewardPoints="rewardPoints"></point-gift>
    <!-- 关注二维码 -->
    <offical-account
      v-if="ebooksDetail && ebooksDetail.bargain"
      :showAccountQcode="showAccountQcode"
      :desc="officalDesc"
      :imgSrc="$addXossFilter(mpQrcode)"
      @hideDialog="hideDialog"
    ></offical-account>
    <!-- 关联售卖 -->
    <related-combo
      :distributionId="distributionId"
      @closeCombo="closeCombo"
      @getMore="getMore"
      :showCombo="showCombo"
      :packageMore="is_page_package"
      :columnMore="is_page_column"
      :packageList="belongPackageList"
      :columnList="belongColumnList"
    ></related-combo>
    <promote-income v-if="ebooksDetail && ebooksDetail.isSaleOut != 0 && (ebooksDetail.showInvitionCard || ebooksDetail.showMarketingCard)" :showInvitionCard="ebooksDetail.showInvitionCard" :showMarketingCard="ebooksDetail.showMarketingCard" :prodId="id" :prodType="ckFrom.ebooks" zClass="c-pz101 c-p-t90" @goInvite="inviteFriends" @goMarketingPoster="invitePoster"></promote-income>
    <collage-grades ref="collageGrades" :relType="21" :refereeId="refereeId" :isRelForm="ebooksDetail.isRelForm && !ebooksDetail.hasFormLog" :extId="id" :bindPhoneSetting="bindPhoneSetting" :goodsRoomId="goodsRoomId" :recRelateId="recRelateId" :recType="recType" :dataInfo="ebooksDetail"></collage-grades>
    <comfirm-com :showPassword.sync="showPassword" :pwTip="ebooksDetail.pwTip" text="输入密码阅读电子书" @submitPassword="clickAddEnter"></comfirm-com>
    <gift-modal :showGiftModal="isOpenPopGift" :hasBuy="ebooksDetail.hasPermission" :prodList="ebooksDetail.giftRelates || []" @closeGift="isOpenPopGift = false"></gift-modal>
  </div>
</template>

<script>
import { mapMutations, mapState } from 'vuex';
import { utilJs, wxUtilJs } from "@/utils/common.js";
import ComfirmCom from "@/components/templates/common/comfirmCom.vue";
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import bottomBuyCom from "@/components/templates/common/bottomBuyCom.vue";
import couponListCom from "@/components/templates/couponListCom.vue";
import PackageIndexCom from "@/components/templates/packageIndexCom.vue";
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import ActiveAndColumn from "@/components/templates/activeAndColumn.vue";
import PriceBar from '@/components/templates/common/priceBar.vue';
import DiscountTip from "@/components/templates/common/discountTip.vue";
import FlashSalesTimeNew from "@/components/templates/flashSalesTimeNew.vue";
import bargainRules from '@/components/templates/bargain/bargainRules';
import officalAccount from '@/components/templates/common/officalAccount';
import commentCom from "@/components/templates/common/commentCom.vue";
import relatedCombo from '@/components/templates/relatedCombo';
import CollagePersonsList from "@/components/templates/collage/collagePersonsList.vue";
import CampCourse from "@/components/homePage/ebooks/campCourse.vue"
import PromoteIncome from '@/components/templates/common/promoteIncome.vue';
import validTimeCom from "@/components/templates/common/validTimeCom.vue";
import formEntry from "@/components/homePage/form/formEntry.vue"
import { getBindPhoneSetting } from "@/utils/checkUnBindPhone.js";
import collageGrades from "@/components/templates/collage/collageGrades.vue";
import pointGift from "@/components/templates/common/pointGift.vue";
import courseDescription from '@/components/templates/courseDescription';
import giftModal from '@/components/templates/giftModal';
const LIMIT = 30;
let pageIndex = 0;
let page = 1;
let isLoading = false;
export default {
  name: "EbooksDetail",
  components: {
    ComfirmCom,
    MySmallTabbar,
    bottomBuyCom,
    couponListCom,
    loadingStatusTem,
    PackageIndexCom,
    ActiveAndColumn,
    PriceBar,
    DiscountTip,
    FlashSalesTimeNew,
    bargainRules,
    officalAccount,
    commentCom,
    relatedCombo,
    CollagePersonsList,
    CampCourse,
    PromoteIncome,
    validTimeCom,
    formEntry,
    collageGrades,
    pointGift,
    courseDescription,
    giftModal
  },
  data() {
    return {
      customPointName: localStorage.getItem("customPointName"),
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      isiOS: navigator.userAgent.indexOf('IOSLogin') > -1 || navigator.userAgent.indexOf('IOSNewLogin') > -1 || navigator.userAgent.indexOf("IOSNewApp") > -1,
      vipType: localStorage.getItem("vipType" + localStorage.getItem("userId")),
      id: '', //电子书id
      tabList: [{
        title: '详情',
        index: 0
      }, {
        title: '目录',
        index: 1
      }, {
        title: '相关推荐',
        index: 2
      }],
      tabhBarFixed: false,
      typeBar: 0,
      ebooksDetail: '',
      couponList: [], //优惠卷
      showCoupon: false, // 是否显示优惠卷
      couponLoading: false, // 优惠卷加载
      couponIsPage: false,
      couponPage: 1,
      pdfArray: [], // 缩略图
      epubArray: [], //epub目录数据
      formatType: '',
      pdfNum: 0, //pdf章节总数
      epubNum: 0, //epub总数
      dataStatus: 'HAS_MORE_DATA',
      showPassword: false, //显示密码
      showPoints: false, //显示赠送积分
      rewardPoints: 0, //积分数
      relationData: '', //相关推荐
      trailChaptersNum: '', //试读章节数
      watchPermission: 0, //默认 0未开启试读
      accessToken: '',
      isSalesBegin: false,
      faStatus: 1,
      cfg: JSON.parse(localStorage.getItem("cfg")),
      showAccountQcode: false,
      officalDesc: '关注我们后才可发起砍价哦',
      mpQrcode: '',
      ckFrom: global.ckFrom,
      commentStatus: 0,
      showCombo: false,
      distributionId: '',
      is_page_package: false,
      is_page_column: false,
      belongPackageList: [],
      belongColumnList: [],
      belongLoading: false,
      pagePackage: 1,
      pageColumn: 2,
      goodsRoomId: '', //社群id
      recRelateId: '', //推荐人id
      recType: 0, //推荐人类型
      hasExpired: false,
      timingPutOn: false,
      isShowFormlg:localStorage.getItem("showForm") == 1 ? true : false,
      isOffSale: false, //是否下架
      bindPhoneSetting: null,
      // 训练营参数
      ttId: '',
      tpId: '',
      tlId: '',
      themeId: '', //来源圈子任务的主题id
      enableShowModuleView: localStorage.getItem("cfg") ? JSON.parse(localStorage.getItem("cfg")).enableShowModuleView : 1,
      enableHiddenModules: localStorage.getItem("cfg") ? JSON.parse(localStorage.getItem("cfg")).enableHiddenModules : [],
      optimal: null, // 最低价格返回对象
      isOpenPopGift: false, //是否弹出赠送有礼
    }
  },
  computed: {
    ...mapState({
      showNavBar: (state) => state.oem_store.showNavBar,
    }),
    showMarketingBar() {
      return this.ebooksDetail &&
        (
          this.ebooksDetail.isFriendHelper && (this.faStatus == 1 || this.faStatus == 2) ||
          this.ebooksDetail.sales ||
          (this.ebooksDetail.collage && (this.ebooksDetail.collage.status == 2 || this.ebooksDetail.collage.status == 1)) ||
          (this.ebooksDetail.bargain && ((this.ebooksDetail.bargain.status == 1 && this.ebooksDetail.bargain.isPreheat == 1) || this.ebooksDetail.bargain.status == 2))
        )
    },
   // 获取按钮专享价名称
    getBuyBtnTitle() {
      if (this.optimal) {
        const agentName = utilJs.getCustNameMap();
        let btnTxt = '立即购买';
        let idDiscount = (this.vipType == 3 || this.vipType > 4) && this.ebooksDetail.commonProdInfo && this.ebooksDetail.commonProdInfo.agentDiscount < 100
          ? this.ebooksDetail.commonProdInfo.agentDiscount
          : (this.vipType == 4 && this.ebooksDetail.svipDiscount < 100)
            ? this.ebooksDetail.svipDiscount
            : (this.vipType == 2 && this.ebooksDetail.vipDiscount < 100)
              ? this.ebooksDetail.vipDiscount
              : 100
        let discountPrice = Number(this.ebooksDetail.price * idDiscount / 100).toFixed(2);
        btnTxt = discountPrice * 1 != this.ebooksDetail.price ? (this.vipType != 1 ? (this.vipType == 2 ? 'VIP专享价' : this.vipType == 4 ? 'SVIP专享价' : agentName[this.vipType] + '专享价') : '立即购买') : '立即购买';
        if (this.ebooksDetail.sales && this.optimal.optimalPriceType == 101) {
          btnTxt = '立即购买';
        }
        return btnTxt
      }
      return '立即购买'
    },
    // 显示评论模块判断
    isShowComments() {
      return function(type) {
        if (!(this.cfg && this.cfg.enableComment == 1 && this.cfg.enableEbookComment == 1 && this.commentStatus == 1)) return
        let isShowComment = false;
        if (type == 'icon' && this.cfg.enableCommentBottom == 1 && this.cfg.enableCommentTag != 1 && this.typeBar != 3) {
          isShowComment = true;
        } else if (type == 'tag' && this.cfg.enableCommentTag == 1 && this.typeBar == 3) {
          isShowComment = true;
        } else if (type == 'detail' && this.cfg.enableCommentBottom == 1) {
          isShowComment = true;
        } else {
          isShowComment = false;
        }
        return isShowComment;
      }
    },
    isMarketing() {
      let isMarketing = this.ebooksDetail &&
        (this.ebooksDetail.sales ||
          (this.ebooksDetail.bargain && ((this.ebooksDetail.bargain.status == 1 && this.ebooksDetail.bargain.isPreheat == 1) || this.ebooksDetail.bargain.status == 2)) ||
          (this.ebooksDetail.collage && (this.ebooksDetail.collage.status == 2 || this.ebooksDetail.collage.status == 1)) ||
          this.ebooksDetail.isFriendHelper)
      return isMarketing
    },
    isFavourable() {
      let isFavourable = this.ebooksDetail && ((this.ebooksDetail.bargain && ((this.ebooksDetail.bargain.status == 1 && this.ebooksDetail.bargain.isPreheat == 1) || this.ebooksDetail.bargain.status == 2)) || this.ebooksDetail.isFriendHelper)
      return isFavourable
    },
    //单卖&&没有权限&&价格大于0&&（加入形式&&不是好友助力）&&（优惠券||vip svip折扣信息||积分抵扣）&&（是否参与营销）
    showDiscount() {
      let showdiscount = this.ebooksDetail.isSaleOnly != 0 && Number(this.ebooksDetail.price) > 0 && !this.ebooksDetail.isFriendHelper && !this.ebooksDetail.hasPermission
      return showdiscount
    },
    //营销原价计算价格
    calculationPrice() {
      let idDiscount = (this.vipType == 3 || this.vipType > 4) && this.ebooksDetail.commonProdInfo && this.ebooksDetail.commonProdInfo.agentDiscount < 100
        ? this.ebooksDetail.commonProdInfo.agentDiscount
        : (this.vipType == 4 && this.ebooksDetail.svipDiscount < 100)
          ? this.ebooksDetail.svipDiscount
          : (this.vipType == 2 && this.ebooksDetail.vipDiscount < 100)
            ? this.ebooksDetail.vipDiscount
            : 100;
      let calculationPrice = Number(this.ebooksDetail.price * idDiscount / 100).toFixed(2);
      if (this.optimal && this.ebooksDetail.isFriendHelper) {
        calculationPrice = Number(this.optimal.optimalPrice).toFixed(2);
      }
      return calculationPrice;
    },
    isForceFrom() {
      let isForceFrom = this.ebooksDetail.hasPermission && ((this.ebooksDetail.collectPage == 3 && this.ebooksDetail.isRelForm == true && this.ebooksDetail.hasFormLog == false && this.isShowFormlg) || (this.ebooksDetail.hasFormLog && this.ebooksDetail.enableEdit == 2 && this.isShowFormlg && this.ebooksDetail.isRelForm == true));
      return isForceFrom;
    },
    isUserGroup() { // true: 指定用户购买或者观看，但是该用户不属于指定用户  false：非指定用户购买或者观看，或者该用户属于指定用户
      let isUserGroup = ((!this.ebooksDetail.hasPermission) || (this.ebooksDetail.hasPermission && (this.ebooksDetail.payType != 2 || (this.vipType > 1 && ((this.ebooksDetail.vipDiscount == 0 && (this.ebooksDetail.permissionType == 2 || this.ebooksDetail.permissionType == 3 || this.ebooksDetail.permissionType == 19)) || (this.ebooksDetail.svipDiscount == 0 && (this.ebooksDetail.permissionType == 3 || this.ebooksDetail.permissionType == 19))))))) && (this.ebooksDetail.isUserGroup == 1 && this.ebooksDetail.isInUserGroup != 1);
      return isUserGroup;
    },
    // 是否显示立即购买
    isShowClickBuy() {
      // 没有参加营销活动、好有助力、砍价、拼团--显示直接购买、限时折扣-显示立即抢购
      if (this.ebooksDetail.isFriendHelper && (this.faStatus == 1 || this.faStatus == 2)) {//好有助力
        return true
      } else if (this.ebooksDetail.bargain != null && ((this.ebooksDetail.bargain.status == 1 && this.ebooksDetail.bargain.isPreheat == 1) || this.ebooksDetail.bargain.status == 2)) {
        // 砍价
        return true
      } else if ( this.ebooksDetail.collage != null && (this.ebooksDetail.collage.status == 2 || this.ebooksDetail.collage.status == 1) && this.ebooksDetail.collage.userType == -1) {
        // 拼团
        return true
      } else if (this.ebooksDetail.sales && this.faStatus == 1) {
        // 限时折扣活动预热未开始
        return true
      } else if (!this.ebooksDetail.isFriendHelper && !this.ebooksDetail.bargain && !this.ebooksDetail.collage && !this.ebooksDetail.sales) {
        // 没有营销活动（好有助力
        return true
      }
      return false
    },
  },
  created() {
    utilJs.appShare(this);
  },
  deactivated() {
    this.$store.commit("updateHasNoticeText", false);
    this.dataStatus = 'NO_MORE_DATA';
    sessionStorage.removeItem(this.id + 'rewardPoints');
    window.removeEventListener('scroll', this.windowScrollFunction);
    window.removeEventListener('scroll', this.handleScroll);
  },
  watch: {
    $route(to, from) {
      if (to.path == "/homePage/ebooks/ebooksDetail" && from.path == "/homePage/ebooks/ebooksDetail") {
        this.initActivatedData();
        this.getFormName();
      }
    }
  },
  mounted() {
    setDocumentTitle("电子书");
    this.initActivatedData();
  },
  methods: {
    popGiftModal() {
      this.isOpenPopGift = true;
    },
    addCommentSuccess() {
      // 确保详情tab下的评论列表和评论tab下的列表数据可以同时更新
      if (this.typeBar == 0 && this.$refs.commentCom) {
        this.$refs.commentCom.public_initData()
      }
      if (this.typeBar == 3 && this.$refs.detailCommentCom) {
        this.$refs.detailCommentCom.public_initData()
      }
    },
    getCommentCount(count = 0) {
      if (count && count > 0) {
        const index = this.tabList.findIndex(i => i.title == '评论')
        index > -1 && this.$set(this.tabList[index], "smallNum", count);
      }
    },
    addComment() {
      const index = this.tabList.findIndex(i => i.title == '评论')
      this.typeBar = index > -1 ? this.tabList[index].index : 0
      this.$nextTick(() => {
        if (index > -1 && this.$refs.commentCom) {
          this.$refs.commentCom.public_addComment()
        } else if (this.$refs.detailCommentCom) {
          this.$refs.detailCommentCom.public_addComment()
        }
      })
    },
    // 查看放大图片
    clickPreviewImage(imgSrc) {
      let imgArr = [];
      imgArr.push(imgSrc);
      wxUtilJs.previewImage({
        current: imgSrc, // 当前显示图片的http链接
        urls: imgArr // 需要预览的图片http链接列表
      });
    },
    getFormName() {
      utilJs.getMethod(
        global.apiurl + "k12/forms/getGuideInfo?relId=" + this.id + "&relType=21",
        res => {
          this.formGuideTitle = res.guideTitle ? res.guideTitle : '报名信息';
          this.formGuideWord = res.guideWord ? res.guideWord : '填写报名信息';
        }
      );
    },
    initActivatedData() {
      this.tabList = [{
        title: '详情',
        index: 0
      }, {
        title: '目录',
        index: 1
      }, {
        title: '相关推荐',
        index: 2
      }];
      this.goodsRoomId = this.$route.query.goodsRoomId || '';
      this.recRelateId = this.$route.query.recRelateId || '';
      this.ttId = this.$route.query.ttId || '';
      this.tpId = this.$route.query.tpId || '';
      this.tlId = this.$route.query.tlId || '';
      this.recType = this.$route.query.recType || '';
      this.themeId = this.$route.query.themeId || '';
      this.distributionId = '';
      this.is_page_package = false;
      this.is_page_column = false;
      this.belongPackageList = [];
      this.belongColumnList = [];
      this.belongLoading = false;
      this.pagePackage = 1;
      this.pageColumn = 2;
      this.distributionId = '';
      this.showCombo = false;
      pageIndex = 0;
      page = 1;
      this.cIndex = -1;
      this.commentStatus = 0;
      this.dataStatus = 'HAS_MORE_DATA';
      this.id = this.$route.query.id;
      this.accessToken = this.$route.query.accessToken || '';
      this.typeBar = 0;
      this.officalDesc = '关注我们后才可发起砍价哦';
      this.mpQrcode = '';
      this.ebooksDetail = '';
      this.couponList = [];
      this.pdfArray = [];
      this.epubArray = [];
      this.showCoupon = false;
      this.couponLoading = false;
      this.couponIsPage = false;
      this.showAccountQcode = false;
      this.couponPage = 1;
      this.faStatus = 1;
      this.showPassword = false;
      this.tabhBarFixed = false;
      this.relationData = '';
      this.hasExpired = false;
      this.timingPutOn = false;
      this.isOffSale = false;
      this.optimal = null;
      getBindPhoneSetting(global.ckFrom.ebooks).then(res => {
        this.bindPhoneSetting = res;
      });
      this.getEbookDetail();
      window.addEventListener('scroll', this.handleScroll);
    },
    ...mapMutations(['updateEbooksPage']),
    putOn() {
      this.ebooksDetail.status = 1;
      this.timingPutOn = false;
    },
    relevance() {
      let _this = this;
      utilJs.postMethod(
        global.apiurl + "common/relevance",
        { objId: this.id, ckFrom: global.ckFrom.ebooks },
        function (res) {
          _this.relationData = res;
        }
      );
    },
    // 判断是否跳转表单
    isGoForm (bargainId = false) {
      // 购买前后判断collectPage：1购买前2购买后3非强制
      // 砍价属于非强制，无论选择购买前后都先跳转表单--7.11改了，砍价也有购买后流程了,不是砍价才跳转
      if ((this.ebooksDetail.collectPage == 1 || (this.ebooksDetail.collectPage == 2 && this.ebooksDetail.hasPermission == true)) && this.ebooksDetail.isRelForm == true && this.ebooksDetail.hasFormLog == false && localStorage.getItem("showForm") == 1) {
        this.goForm();
        return true;
      } else {
        return false;
      }
    },
    // 关联表单
    goForm() {
      let pathQuery = null;
      let isGoBack = this.ebooksDetail.collectPage == 3 || this.ebooksDetail.payType == 3 || this.ebooksDetail.hasPermission == true || (this.isMarketing && !this.ebooksDetail.sales) || this.ebooksDetail.isSaleOnly == 0 ? 1 : 0;
      let pId = this.ebooksDetail.sales && this.faStatus == 2 ? this.ebooksDetail.sales.pId : null;
      let ckFrom = this.ebooksDetail.sales ? global.ckFrom.flashSalesEbooks : this.$refs.bottomBuyCom.isShowPresent ? global.ckFrom.presentEbooks : global.ckFrom.ebooks;
      let bargainId = this.ebooksDetail.bargain ? this.ebooksDetail.bargain.bargainId : '';
      pathQuery = {
        cId: -1,
        extId: this.id,
        ckFrom: ckFrom,
        isFromInvite: 0,
        pId: pId,
        relType: 21,
        type: 1,
        recRelateId: this.$route.query.recRelateId,
        recType: this.$route.query.recType,
        isGoBack: isGoBack,
        bargainId: bargainId
      };
      if (this.goodsRoomId) {
        pathQuery.goodsRoomId = this.goodsRoomId;
      }
      this.$routerGo(this, "push", { path: '/homePage/form', query: pathQuery });
    },
    // 拼团跳转
    gcd(cinfo) {
      this.goCollageDetail(cinfo.groupId, cinfo.collageId);
    },
    goCollageDetail(groupId, collageId) {
      if (this.isUserGroup) {
        this.$showCjToast({
          text: '指定用户可以购买',
          type: 'text'
        });
        return;
      }
      let hfs = this.ebooksDetail.isRelForm && !this.ebooksDetail.hasFormLog;
      if (this.ebooksDetail.collage.userType != -1 && this.ebooksDetail.collage.groupId != groupId) {
        this.$showCjToast({
          text: '您已在拼团中，不需要再去拼单啦！',
          type: 'warn'
        });
        return;
      }
      if (this.ebooksDetail.collage.status == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能拼团！',
          type: 'warn'
        });
        return;
      }
      if (this.isGoForm(true)) return;
      let pathQuery = {
        'groupId': groupId,
        'collageId': collageId,
        isRelForm: hfs,
        extId: -1,
        relType: 4,
        recRelateId: this.$route.query.recRelateId,
        recType: this.$route.query.recType
      };
      if (this.goodsRoomId) {
        pathQuery.goodsRoomId = this.goodsRoomId;
      }
      this.$routerGo(this, "push", {
        path: "/homePage/collage/collageDetail",
        query: pathQuery
      });
    },
    goBuy(groupId, collageId) {
      if (this.isUserGroup) {
        this.$showCjToast({
          text: '指定用户可以购买',
          type: 'text'
        });
        return;
      }
      // let hfs = this.ebooksDetail.isRelForm && !this.ebooksDetail.hasFormLog;
      if (this.ebooksDetail.collage.userType != -1 && this.ebooksDetail.collage.groupId != groupId) {
        this.$showCjToast({
          text: '您已在拼团中，不需要再去拼单啦！',
          type: 'warn'
        });
        return;
      }
      if (this.ebooksDetail.collage.status == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能拼团！',
          type: 'warn'
        });
        return;
      }
      if (this.isGoForm(true)) return;
      //要加判断是否选择阶梯
      if (this.ebooksDetail.collage && this.ebooksDetail.collage.collageGroupType == 1 ) {
        this.$refs.collageGrades.goChoseBuy()
      } else {
        this.$refs.collageGrades.showBuy()
        // this.isShowBuy = true; //选择阶梯
      }
    },
    handleClickBuySales() {
      // 点击立即抢购限时购
      // 判断是否绑定手机号
      let queryT = null;
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      let pId = this.ebooksDetail.sales.pId;
      if (this.isGoForm()) return;
      queryT = {
        cId: -1, //电子书id
        extId: this.id, //电子书id
        ckFrom: global.ckFrom.flashSalesEbooks, //前端对限时购定义得值
        isFromInvite: 0,
        isFromOrder: "TRUE"
      }
      if (this.ebooksDetail.sales && this.faStatus == 2 && this.ebooksDetail.sales.pId && this.optimal && this.optimal.optimalPriceType == 101) {
        queryT.pId = pId;
      } else if (this.optimal && this.optimal.optimalPriceType != 101) {
        queryT.ckFrom = 142;
      }
      this.$routerGo(this, "push", {
        path: "/homePage/course/coursePay",
        query: queryT
      });
    },
    getMore(tType) {
      this.getBelong(tType)
    },
    getBelong(tabType) {
      if (!this.belongLoading) {
        this.belongLoading = true;
        let $this = this;
        if (tabType == 1) {
          let getUrl = `${global.apiurl}combos/showAll?`;
          if (this.distributionId) {
            getUrl = `${global.apiurl}distributionMarkets/showAll?`;
          }
          utilJs.getMethod(getUrl + 'proType=12&proId=' + this.id + '&page=' + this.pagePackage + '&limit=10' + '&tabType=' + tabType, function (res) {
            $this.belongLoading = false;
            $this.belongPackageList = $this.belongPackageList.concat(res.list.combos.data);
            if ($this.pagePackage == 1) { //从课程刚进来页面的时候需要获取专栏列表，第二页开始不需要了
              $this.belongColumnList = res.list.columns.data;
            }
            $this.pagePackage = res.list.combos.current_page < res.list.combos.last_page ? ($this.pagePackage + 1) : $this.pagePackage;
            $this.is_page_package = res.list.combos.current_page < res.list.combos.last_page ? true : false;
          }, failRes => {
            $this.belongLoading = false;
          });
        } else if (tabType == 2) {
          let getUrl = `${global.apiurl}combos/showAll?`;
          if (this.distributionId) {
            getUrl = `${global.apiurl}distributionMarkets/showAll?`;
          }
          utilJs.getMethod(getUrl + 'proType=12&proId=' + this.id + '&page=' + this.pageColumn + '&limit=10' + '&tabType=' + tabType, function (res) {
            $this.belongLoading = false;
            $this.belongColumnList = $this.belongColumnList.concat(res.list.columns.data);
            $this.pageColumn = res.list.columns.current_page < res.list.columns.last_page ? ($this.pageColumn + 1) : $this.pageColumn;
            $this.is_page_column = res.list.columns.current_page < res.list.columns.last_page ? true : false;
          }, failRes => {
            $this.belongLoading = false;
          });
        }
      }
    },
    // 关闭关联套餐弹窗
    closeCombo() {
      this.showCombo = false;
    },
    backPackage() {
      this.showCombo = true;
    },
    hideDialog() {
      this.showAccountQcode = false;
    },
    getCommentStatus() {
      this.commentStatus = 0;
      if (this.cfg && this.cfg.enableComment == 1 && this.cfg.enableEbookComment == 1) {
        this.commentStatus = 1;
        this.$store.commit("updateHasNoticeText", false);
        this.$nextTick(() => {
          this.$refs.commentCom && this.$refs.commentCom.public_initData()
          this.$refs.detailCommentCom && this.$refs.detailCommentCom.public_initData()
        })
      }
    },
    // 判断是否关注公众号
    checkUserIsFollowedMp() {
      let _this = this;
      return new Promise(function (resolve, reject) {
        utilJs.getMethod(`${global.apiurl}bargains/getMpData?bargainId=${_this.ebooksDetail.bargain.bargainId}`,
          res => {
            resolve(res);
          },
          failRes => {
            reject(failRes)
          }
        )
      })
    },
    handleClickBargainDetail(bargainId) {
      if (this.ebooksDetail.bargain.status == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能砍价！',
          type: 'warn'
        });
        return;
      }
      this.checkUserIsFollowedMp().then(res => {
        if (res.threshold == 2 && res.isFollowedMp == 0) {
          this.mpQrcode = res.mpQrcode;
          this.showAccountQcode = true;
          return;
        }
        // 判断是否绑定手机号
        if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
          if (utilJs.goBindMobile()) return;
        }
        // if (this.isGoForm(true)) return;
        // 砍价--购买前表单
        if (this.ebooksDetail.collectPage == 1 && this.ebooksDetail.isRelForm == true && this.ebooksDetail.hasFormLog == false && localStorage.getItem("showForm") == 1) {
          this.goForm();
        } else if (this.ebooksDetail.bargain.status == 2) {
          this.$routerGo(this, "push", {
            path: "/homePage/bargain/bargainDetail",
            query: {
              bargainId: bargainId
            }
          });
        }
      })
    },
    // epub跳转
    handleClickReadBookEbup(item) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.getBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.timingPutOn || this.isOffSale || this.isUserGroup) {
        this.$showCjToast({
          text: this.timingPutOn ? '该电子书暂未开售！' : this.isOffSale ? '该电子书已下架' : (this.ebooksDetail.payType == 2 ? '仅指定用户可购买' : '仅指定用户可阅读'),
          type: 'text'
        });
        return;
      }
      if (this.isGoForm()) return;
      if (this.ebooksDetail.isSaleTogether == 1 && this.ebooksDetail.isSaleOnly == 0) {
        // 关联售卖
        if (item.isLock == 1) {
          // 锁住状态
          this.$showCjToast({
            text: "购买套餐后才可阅读该电子书",
            type: "warn",
            time: 1500
          });
          return true;
        } else {
          this.increaseViewNum();
          this.$routerGo(this, "push", {
            path: "/homePage/ebooks/ebooks",
            query: {
              ebId: this.id,
              ebrId: this.ebooksDetail.ebrId,
              accessToken: this.accessToken,
              ttId: this.ttId,
              tpId: this.tpId,
              tlId: this.tlId
            }
          })
          this.updateEbooksPage(item.src)
        }
      } else {
        if (item.isLock == 1 && this.ebooksDetail.payType == 2) {
          // 锁住状态
          this.$showCjToast({
            text: "购买之后解锁章节",
            type: "warn",
            time: 1500
          });
          return true;
        } else if (item.isLock == 1 && this.ebooksDetail.payType == 3) {
          // 锁住状态，密码模式
          this.$showCjToast({
            text: "输入密码之后解锁章节",
            type: "warn",
            time: 1500
          });
          return true;
        } else {
          this.increaseViewNum();
          this.$routerGo(this, "push", {
            path: "/homePage/ebooks/ebooks",
            query: {
              ebId: this.id,
              ebrId: this.ebooksDetail.ebrId,
              accessToken: this.accessToken,
              ttId: this.ttId,
              tpId: this.tpId,
              tlId: this.tlId
            }
          })
          this.updateEbooksPage(item.src)
        }
      }
    },
    // pdf跳转
    handleClickReadBookPdf(item) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.getBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.isGoForm()) return;
      if (this.ebooksDetail.isSaleTogether == 1 && this.ebooksDetail.isSaleOnly == 0) {
        // 关联售卖
        if (item.isLock == 1) {
          // 锁住状态
          this.$showCjToast({
            text: "购买套餐后才可阅读该电子书",
            type: "warn",
            time: 1500
          });
          return true;
        } else {
          this.increaseViewNum();
          this.$routerGo(this, "push", {
            path: "/homePage/ebooks/ebooks",
            query: {
              ebId: this.id,
              ebrId: this.ebooksDetail.ebrId,
              accessToken: this.accessToken,
              ttId: this.ttId,
              tpId: this.tpId,
              tlId: this.tlId
            }
          })
          this.updateEbooksPage(item.src)
        }
      } else {
        if (item.isLock == 1 && this.ebooksDetail.payType == 2) {
          // 锁住状态,付费   payType1 免费, 2 付费, 3 密码
          this.$showCjToast({
            text: "购买之后解锁章节",
            type: "warn",
            time: 1500
          });
          return true;
        } else if (item.isLock == 1 && this.ebooksDetail.payType == 3) {
          // 锁住状态，密码模式
          this.$showCjToast({
            text: "输入密码之后解锁章节",
            type: "warn",
            time: 1500
          });
          return true;
        } else {
          this.increaseViewNum();
          this.$routerGo(this, "push", {
            path: "/homePage/ebooks/ebooks",
            query: {
              ebId: this.id,
              ebrId: this.ebooksDetail.ebrId,
              page: item.page,
              accessToken: this.accessToken,
              ttId: this.ttId,
              tpId: this.tpId,
              tlId: this.tlId
            }
          })
        }
      }
    },
    // 点击开始阅读
    handleClickReadBook() {
      if (this.bindPhoneSetting && this.bindPhoneSetting.getBind) {
        if (utilJs.goBindMobile()) return;
      }
      // 开始阅读说明已经购买--去掉砍价标识---防止填完表单跳转到砍价详情页
      this.$set(this.ebooksDetail, 'bargain', null);
      if (this.isGoForm()) return;
      // 点击开始阅读请求一次阅读接口
      this.increaseViewNum();
      this.$routerGo(this, "push", {
        path: "/homePage/ebooks/ebooks",
        query: {
          ebId: this.id,
          ebrId: this.ebooksDetail.ebrId,
          inputPwd: '',
          accessToken: this.accessToken,
          ttId: this.ttId,
          tpId: this.tpId,
          tlId: this.tlId
        }
      })
    },
    // 点击弹窗密码
    handleClickPassword() {
      if (this.bindPhoneSetting && this.bindPhoneSetting.passwordBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.ebooksDetail.collectPage != 3 && this.ebooksDetail.isRelForm == true && this.ebooksDetail.hasFormLog == false && localStorage.getItem("showForm") == 1) {
        this.goForm();
        return
      }
      this.showPassword = true;
    },
    // 弹窗密码点击确定按钮
    clickAddEnter(pwd = '') {
      if (isLoading) {
        return;
      }
      isLoading = true;
      let data = {
        encrypt: this.ebooksDetail.payType == 3 ? pwd : ''
      }
      utilJs.postMethod(`${global.apiurl}ebooks/verifyPassword/${this.id}`, data, res => {
        isLoading = false;
        this.showPassword = false;
        this.tabList = [{
          title: '详情',
          index: 0
        }, {
          title: '目录',
          index: 1
        }, {
          title: '相关推荐',
          index: 2
        }];
        this.getEbookDetail();
        this.$showCjToast({
          text: "解锁成功！",
          type: "success",
        });
      }, failRes => {
        isLoading = false;
      })
    },
    // 购买电子书
    clickBuy() {
      // 判断是否绑定手机号
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.isGoForm()) return;
      let queryT = null;
      queryT = {
        cId: 0,
        extId: this.id,
        ckFrom: global.ckFrom.ebooks,
        extraId: 0,
      }
      this.$routerGo(this, "push", {
        path: "/homePage/course/coursePay",
        query: queryT
      });
    },
    // 赠送好友
    clickBuyNow() {
      //电子书被删除
      if (this.ebooksDetail.assetStatus == -1) {
        this.$showCjToast({
          text: "该电子书已被管理员删除，如有疑问请咨询客服",
          type: "warn",
          time: 1000,
        });
        return;
      }
      // 判断是否绑定手机号
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.isGoForm()) return;
      let queryT = null;
      let pId = this.ebooksDetail.sales && this.faStatus == 2 ? this.ebooksDetail.sales.pId : null;
      queryT = {
        cId: 0,
        extId: this.id,
        ckFrom: global.ckFrom.presentEbooks,
        isFromInvite: 0,
        pId: pId,
      }
      this.$routerGo(this, "push", {
        path: "/homePage/course/coursePay",
        query: queryT
      });
    },
    // 获取目录接口
    getIndexByPage() {
      if (this.dataStatus == 'LOADING') {
        return;
      }
      this.dataStatus = 'LOADING';
      utilJs.getMethod(`${global.apiurl}ebooks/getIndexByPage/${this.id}?index=${pageIndex}&ttId=${this.ttId}&page=${page}&limit=${LIMIT}&accessToken=${this.accessToken}&themeId=${this.themeId}`,
        res => {
          if (res.assetStatus == -1) {
            this.dataStatus = 'NO_DATA';
            return;
          }
          // this.formatType = res.formatType;
          this.trailChaptersNum = res.trailChaptersNum; //试读章节数
          this.watchPermission = res.watchPermission; //开启章节数 0未开启试读1开启试读
          if (res.formatType == 1) {
            this.pdfNum = res.list.total || 0;
            if (pageIndex == 1) {
              this.pdfArray = res.list.data;
            } else {
              this.pdfArray = [...this.pdfArray, ...res.list.data]
            }
            if (res.list.total * 1 == this.pdfArray.length) {
              this.dataStatus = res.list.total * 1 == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
            } else {
              this.dataStatus = 'HAS_MORE_DATA';
              pageIndex += LIMIT;
              page++;
            }
          } else {
            this.epubNum = res.list.total || 0;
            // this.epubArray = res.list;
            // this.dataStatus = 'NO_MORE_DATA';
            if (pageIndex == 1) {
              this.epubArray = res.list.data;
            } else {
              this.epubArray = [...this.epubArray, ...res.list.data]
            }
            if (res.list.total * 1 == this.epubArray.length) {
              this.dataStatus = res.list.total * 1 == 0 ? 'NO_DATA' : 'NO_MORE_DATA';
            } else {
              this.dataStatus = 'HAS_MORE_DATA';
              pageIndex += LIMIT;
              page++;
            }
          }
        },
        failRes => {
          this.dataStatus = 'DATA_ERROR';
          this.$routerGo(this, "replace", {
            path: "/error/emptyPage",
            query: {
              from: "",
              info: "电子书已下架，请联系管理员！"
            }
          });
        }
      )
    },
    // 增加电子书阅读数
    increaseViewNum() {
      utilJs.postMethod(`${global.apiurl}ebooks/increaseViewNum/${this.id}`, '', res => { })
    },
    // 获取电子书详情
    getEbookDetail() {
      let postUrl = `${global.apiurl}ebooks/getEbookDetail/${this.id}?ttId=${this.ttId}&accessToken=${this.accessToken}&time=${new Date().getTime()}&isSkeleton=1`;
      if (this.themeId) {
        postUrl = postUrl + `&themeId=${this.themeId}`
      }
      utilJs.getMethod(postUrl,
        res => {
          if (res == null || res == '' || res.status == -1 || (res.status != 0 && res.status != 1 && res.status != 2 && res.hasPermission == false) || (res.status != 0 && res.status != 1 && res.status != 2 && Number(res.price) == 0 && (!this.accessToken))) {
            let info = res.status == -1 ? '删除' : '下架';
            info = '电子书已' + info + ',请联系管理员！'
            this.$routerGo(this, "replace", {
              path: "/error/emptyPage",
              query: {
                from: "",
                info: info
              }
            });
            return;
          }
          setDocumentTitle(res.name.length > 13 ? (res.name.substring(0, 13) + '...') : res.name);
          if (((!res.hasPermission) || (res.hasPermission && (res.payType != 2 || (this.vipType > 1 && ((res.vipDiscount == 0 && (res.permissionType == 2 || res.permissionType == 3 || res.permissionType == 19)) || (res.svipDiscount == 0 && (res.permissionType == 3 || res.permissionType == 19))))))) && res.status == 0) {
            this.isOffSale = true;
            this.$store.commit("updateHasNoticeText", true);
          }
          if (res.isValid == 2 && (res.permissionType == 0 || res.permissionType == 2 || res.permissionType == 3 || res.permissionType == 19)) {
            this.hasExpired = utilJs.getTimeByDate(res.validAt) - (new Date()).getTime() < 0;
            if (this.hasExpired) {
              this.$store.commit("updateHasNoticeText", true);
            }
          }
          if (res.status == 2 && ((!res.hasPermission) || (res.hasPermission && (res.payType != 2 || (this.vipType > 1 && ((res.vipDiscount == 0 && (res.permissionType == 2 || res.permissionType == 3 || res.permissionType == 19)) || (res.svipDiscount == 0 && (res.permissionType == 3 || res.permissionType == 19)))))))) { //定时上架
            this.timingPutOn = true;
            this.$store.commit("updateHasNoticeText", true);
          }
          this.ebooksDetail = res;
          // optimalPriceType：1 产品本身价格 2 vip价格 3 svip价格 4 服务商 101 限时购 102 拼团 112 砍价  10 链动会员 20 链动代理商 99 链动复购
          this.optimal = res.optimal || null;
          this.formatType = res.formatType;
          // 当有权限的时候，tab切换到目录
          if (res.hasPermission) {
            this.typeBar = 1;
            pageIndex = 1;
            page = 1;
            this.dataStatus = 'HAS_MORE_DATA';
            this.pdfArray = [];
            this.getIndexByPage();
            window.addEventListener('scroll', this.windowScrollFunction);
          }
          // 购买后获得积分
          var rewardPoints = sessionStorage.getItem(this.id + 'rewardPoints');
          if (rewardPoints > 0) {
            this.showPoints = true;
            this.rewardPoints = res.points;
          }
          // 是否开启评论功能
          if (this.cfg && this.cfg.enableComment == 1 && this.cfg.enableCommentTag == 1 && this.cfg.enableEbookComment == 1) {
            this.tabList.push({
              title: '评论',
              index: 3,
              smallNum: 0
            })
          }
          if (this.ebooksDetail.isSaleOnly == 0) {
            // 非单卖获取相关联知识套餐
            this.getBelong(1)
          }
          // 判断限时购库存
          if (this.ebooksDetail.sales && this.ebooksDetail.sales.balance <= 0 && this.ebooksDetail.sales.limit != 0) {
            this.ebooksDetail.sales = null;
          }
          // 重置底部菜单
          this.ebooksDetail.showPresentFriend = this.cfg.enableSales == 1 && !this.isiOS && Number(res.price) > 0 && res.isSaleOnly != 0 && this.ebooksDetail.isUserGroup != 1; //是否显示赠送好友
          this.ebooksDetail.showInvitionCard = this.ebooksDetail.isInvitationCard == 1 && !this.ebooksDetail.isFriendHelper && this.ebooksDetail.bargain == null && this.ebooksDetail.sales == null && this.ebooksDetail.collage == null;
          this.ebooksDetail.showMarketingCard = this.ebooksDetail.isFriendHelper || this.ebooksDetail.bargain || this.ebooksDetail.sales || this.ebooksDetail.collage;
          this.getCommentStatus();
          this.wechatShare();
          this.relevance(); //相关推荐
          this.getCouponList();
          // 关联售卖的课程在试看流程中点击购买跳回本页面，弹窗显示关联售卖
          if (sessionStorage.getItem('showEbooksIsSaleOnly') && Number(sessionStorage.getItem('showEbooksIsSaleOnly') == 0)) {
            this.showCombo = true;
            sessionStorage.removeItem('showEbooksIsSaleOnly')
          }
          this.$nextTick(() => {
            this.$refs.descriptions.getDescptionDetail();
          })
        },
        failRes => {
          this.$routerGo(this, "replace", {
            path: "/error/emptyPage",
            query: {
              from: "",
              info: "电子书已删除或已下架，请联系管理员！"
            }
          });
        }
      );
    },
    // 切换目录
    changeType(type) {
      document.documentElement.scrollTop = 0;
      this.typeBar = type;
      if (type == 1) {
        // pageIndex = 0;
        // page = 1;
        // this.dataStatus = 'HAS_MORE_DATA';
        // this.pdfArray = [];
        if (this.formatType == 1) {
          if (this.pdfArray.length == 0) {
            this.getIndexByPage();
          }
        } else {
          if (this.epubArray.length == 0) {
            this.getIndexByPage();
          }
        }
        window.addEventListener('scroll', this.windowScrollFunction);
      }
      this.handleScroll();
    },
    // 电子书详情点击信息
    handleClickDesc(e) {
      if (e.target.tagName == 'IMG' && e.target.src) {
        wxUtilJs.previewImage({
          current: e.target.src, // 当前显示图片的http链接
          urls: [e.target.src] // 需要预览的图片http链接列表
        });
      }
    },
    // 关闭优惠卷
    closeModal() {
      this.showCoupon = false;
    },
    // 获取可以领取得优惠卷
    getCouponList: function () {
      if (!this.couponLoading) {
        this.couponLoading = true;
        let $this = this;
        utilJs.getMethod(global.apiurl + 'redeemCodes/getCouponsByRedeemType?courseId=' + this.id + '&redeemType=144&limit=10&page=' + this.couponPage, function (res) {
          $this.couponLoading = false;
          $this.couponList = $this.couponList.concat(res.data);
          $this.couponPage = res.next_page_url ? ($this.couponPage + 1) : $this.couponPage;
          $this.couponIsPage = res.next_page_url ? true : false;
        },
          failRes => {
            $this.couponLoading = false;
          }
        );
      }
    },
    //邀请好友
    inviteFriends: function () {
      if (this.bindPhoneSetting && this.bindPhoneSetting.shareBind) {
        if (utilJs.goBindMobile()) return;
      }
      let ckFrom = global.ckFrom.ebooks;//this.ckFrom;
      let extId = this.id;
      this.$routerGo(this, "push", {
        path: "/homePage/spread/spreadCustom",
        query: { cId: 0, extId: extId, ckFrom: ckFrom }
      });
    },
    falshSalesTime(status) {
      if (this.ebooksDetail.isFriendHelper) {
        this.faStatus = status;
      } else if (this.ebooksDetail.bargain) {
        this.ebooksDetail.bargain.status = status
      } else if (this.ebooksDetail.sales) {
        this.faStatus = status;
      } else if (this.ebooksDetail.collage) {
        this.ebooksDetail.collage.status = status;
      }
    },
    finishFlashSales(status) {
      if (this.ebooksDetail.isFriendHelper) {
        this.faStatus = status;
      } else if (this.ebooksDetail.bargain) {
        this.getEbookDetail();
      } else if (this.ebooksDetail.sales) {
        this.faStatus = status;
      } else if (this.ebooksDetail.collage) {
        this.ebooksDetail.collage.status = status;
      }
      // 活动已结束，清空所有营销活动信息及状态
      if (status == -1) {
        this.ebooksDetail.sales = null;
        this.ebooksDetail.collage = null;
      }
    },
    invitePoster() {
      if (this.bindPhoneSetting && this.bindPhoneSetting.shareBind) {
        if (utilJs.goBindMobile()) return;
      }
      let ckFrom = global.ckFrom.ebooks;
      let type = this.ebooksDetail.collage ? 3 : this.ebooksDetail.sales ? 2 : this.ebooksDetail.bargain ? 5 : 4;
      let cId = this.ebooksDetail.collage ? this.ebooksDetail.collage.collageId : this.ebooksDetail.sales ? this.ebooksDetail.sales.pId && this.faStatus == 2 : this.ebooksDetail.isFriendHelper ? this.ebooksDetail.faId : this.ebooksDetail.bargain ? this.ebooksDetail.bargain.bargainId : '';
      let proId = this.$route.query.id;
      this.$routerGo(this, "push", { path: '/homePage/spread/spreadPoster', query: { type: type, ckFrom: ckFrom, cId: cId, proId: proId } });
    },
    goHelpDetail: function () {
      if (this.bindPhoneSetting && this.bindPhoneSetting.helpBind && utilJs.goBindMobile()) {
        return
      }
      if (this.faStatus == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能助力领取！',
          type: 'warn'
        });
      } else {
        this.$routerGo(this, "push", {
          path: "/homePage/task/task",
          query: { 'faId': this.ebooksDetail.faId, 'refereeId': localStorage.getItem("userId") }
        });
      }
    },
    handleScroll: function () {
      var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      var offsetTop = document.querySelector('#tabhBar') != null && document.querySelector('#tabhBar').offsetTop != null ? document.querySelector('#tabhBar').offsetTop : 68;
      if (scrollTop >= offsetTop) {
        this.tabhBarFixed = true;
      } else {
        this.tabhBarFixed = false;
      }
    },
    windowScrollFunction() {
      utilJs.handleLoading(() => {
        if (this.dataStatus == 'HAS_MORE_DATA' && this.typeBar == 1 && (this.pdfArray.length > 0 || this.epubArray.length > 0)) {
          this.getIndexByPage();
        }
      });
    },
    //分享
    wechatShare: function () {
      let title = this.ebooksDetail.shareSetting && this.ebooksDetail.shareSetting.shareTitle ? this.ebooksDetail.shareSetting.shareTitle : (this.ebooksDetail.name || window.localStorage.getItem("shareTitle"));
      if (this.companyAuth.enableFriendHelper == 1 && this.ebooksDetail.isFriendHelper) {
        title = `【快来帮我灌溉吧】${title}`;
      }
      if (this.ebooksDetail.sales) {
        title = `【限时抢购】${title}`;
      }
      if (this.ebooksDetail.bargain != null && ((this.ebooksDetail.bargain.status == 1 && this.ebooksDetail.bargain.isPreheat == 1) || this.ebooksDetail.bargain.status == 2)) {
        title = `【邀您一起砍价】${title}`;
      }
      if (this.ebooksDetail.collage != null && (this.ebooksDetail.collage.status == 2 || this.ebooksDetail.collage.status == 2)) {
        title = `【邀您一起拼团】${title}`;
      }
      let shareImg = this.ebooksDetail.shareSetting && this.ebooksDetail.shareSetting.sharePic ? this.ebooksDetail.shareSetting.sharePic : (this.ebooksDetail.avatar || window.localStorage.getItem("shareLogo"));
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?id=${this.id}&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = this.ebooksDetail.shareSetting && this.ebooksDetail.shareSetting.shareDesc ? this.ebooksDetail.shareSetting.shareDesc : (this.ebooksDetail.shareDesc || window.localStorage.getItem("shareDesc") || '点击查看详情');
      utilJs.wechatConfig(shareUrl, title, shareImg, shareDesc);
    },
    //手机端分享
    appShare: function () {
      let title = this.ebooksDetail.shareSetting && this.ebooksDetail.shareSetting.shareTitle ? this.ebooksDetail.shareSetting.shareTitle : (this.ebooksDetail.name || window.localStorage.getItem("shareTitle"));
      if (this.companyAuth.enableFriendHelper == 1 && this.ebooksDetail.isFriendHelper) {
        title = `【快来帮我灌溉吧】${title}`;
      }
      if (this.ebooksDetail.sales) {
        title = `【限时抢购】${title}`;
      }
      if (this.ebooksDetail.bargain != null && ((this.ebooksDetail.bargain.status == 1 && this.ebooksDetail.bargain.isPreheat == 1) || this.ebooksDetail.bargain.status == 2)) {
        title = `【邀您一起砍价】${title}`;
      }
      if (this.ebooksDetail.collage != null && (this.ebooksDetail.collage.status == 2 || this.ebooksDetail.collage.status == 2)) {
        title = `【邀您一起拼团】${title}`;
      }
      let shareImg = this.ebooksDetail.shareSetting && this.ebooksDetail.shareSetting.sharePic ? this.ebooksDetail.shareSetting.sharePic : (this.ebooksDetail.avatar || window.localStorage.getItem("shareLogo"));
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?id=${this.id}&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = this.ebooksDetail.shareSetting && this.ebooksDetail.shareSetting.shareDesc ? this.ebooksDetail.shareSetting.shareDesc : (this.ebooksDetail.shareDesc || window.localStorage.getItem("shareDesc") || '点击查看详情');
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    }
  }
}
</script>

<style scoped lang="scss">
.c-ww182 {
  width: 4.55rem;
}
.c-maxh272 {
  max-height: 6.8rem;
}
.c-hh272 {
  height: 6.8rem;
}
.c-pr26 {
  padding-right: 0.65rem;
}
.chapters-title {
  height: 2.4rem;
}
.c-hh234 {
  height: 5.85rem;
}
.c-ml56 {
  margin-left: 1.4rem;
}
.minh76 {
  min-height: 1.9rem;
}
.tabhBar {
  width: 100%;
  max-width: 16rem;
  position: fixed;
  top: 1.7rem;
  left: 0;
  right: 0;
  margin: auto;
  background-color: #fff;
  z-index: 500;
}
.iconlock {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.2rem;
  height: 0.25rem;
  margin-top: -0.125rem;
  margin-left: -0.3rem;
  z-index: 1;
  color: #fff;
}
.c-bd1-eee {
  border: 1px solid #eee;
}
.cart-icon{
  background:rgba(255,255,255,0.92);
}
.closeBig >>> p > img,
.closeBig >>> section > img,
.closeBig >>> div > img,
.closeBig >>> img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.aCloseBig >>> p > a > img,
.aCloseBig >>> section > a > img,
.aCloseBig >>> div > a > img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.backdropFilter {
  backdrop-filter: blur(4px);
}
.ebooksPriceBar >>> .priceBar {
  padding-left: 0px !important;
}

/* 营销活动统一样式 */
.btn-wrap > div:first-child {
  color: #ff8831;
  color: var(--mb7color);
  background-color: rgba(255, 99, 45, 0.1);
  background-color: var(--rgba10color);
  border-bottom-left-radius: 0.9rem;
  border-top-left-radius: 0.9rem;
  border: 1px solid #ff8831;
  border: 1px solid var(--mb7color);
}
.btn-wrap > div:nth-child(2) {
  color: white;
  background-color: rgba(255, 99, 45, 0.5);
  background-color: var(--rgba50color);
  border-top: 1px solid #ff8831;
  border-top: 1px solid var(--mb7color);
  border-bottom: 1px solid #ff8831;
  border-bottom: 1px solid var(--mb7color);
}
.btn-wrap > div:last-child {
  color: white;
  background-color: #ff8831;
  background-color: var(--mb7color);
  border-bottom-right-radius: 0.9rem;
  border-top-right-radius: 0.9rem;
  border: none;
  border-top: none;
  border-bottom: none;
}
.theme-market .btn-wrap > div:first-child {
  background-color: var(--rgba10MarketColor);
  border: 1px solid var(--marketColor1);
  color: var(--marketColor1);
}
.theme-market .btn-wrap > div:nth-child(2) {
  background-color: var(--rgba50MarketColor);
  border-top: 1px solid var(--marketColor1);
  border-bottom: 1px solid var(--marketColor1);
  color: var(--marketColor1);
}
.theme-market .btn-wrap > div:last-child {
  background-image: -webkit-linear-gradient(0, var(--marketColor2) 0%, var(--marketColor1) 100%);
  color: #FFFFFF;
}
.cover-container{
  background: url("../../../assets/i/wap/booking/cover_bg.png") no-repeat bottom center;
  background-size: 100% auto;
}
.cover-inner{
  width: 5rem;
  height: 7.5rem;
  background-size: 200% 200%;
  // &:after{
  //   content: "";
  //   position: absolute;
  //   left:0;
  //   right: 0;
  //   top: 0;
  //   bottom: 0;
  //   background-color: rgba(0, 0, 0, 0.5);
  //   filter: blur(2rem);
  // }
  .cover-filter-img{
    position: absolute;
    width: 100%;
    height: 100%;
    filter: blur(0.8rem);
  }
  .zoom-btn{
    padding: .15rem;
    line-height: .55rem;
    border-bottom-left-radius: .25rem;
  }
  .bg-shadow{
    position: absolute;
    left:0;
    top: 0;
    bottom: 0;
    width: .2rem;
    background: url("../../../assets/i/wap/booking/cover_shadow.png") repeat-y left top;
    background-size: 100% auto;
    z-index: 10;
  }
}
</style>